package net.oxygen.upload.service;

import io.minio.CreateMultipartUploadResponse;
import io.minio.ListPartsResponse;
import io.minio.ObjectWriteResponse;
import io.minio.UploadPartResponse;
import net.oxygen.upload.model.MultipartUploadCreate;
import net.oxygen.upload.model.UploadPartCreate;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 接口功能：Minio文件服务接口
 * </p>
 *
 * @author 陈伟伟
 * @since 2023/12/18 11:23
 */
public interface IMinioService {

    String uploadFile(MultipartFile file, String bucketName);

    CreateMultipartUploadResponse uploadId(MultipartUploadCreate uploadCreate);

    UploadPartResponse uploadPart(UploadPartCreate uploadPartCreate);

    ListPartsResponse listMultipartUploads(MultipartUploadCreate uploadCreate);

    ObjectWriteResponse completeMultipartUpload(MultipartUploadCreate uploadCreate);

    /**
     * 判断存储桶是否存在
     * @param bucketName 桶名称
     * @return 是否存在
     */
    Boolean bucketExists(String bucketName);

    /**
     * 创建桶
     * @param bucketName 桶名称
     */
    void makeBucket(String bucketName);

    /**
     * 获取分片信息列表
     * @param bucketName 桶名称
     * @param objectName 对象名称（含路径）
     * @param maxParts 分片数量
     * @param uploadId 上传任务编号
     * @return 分片信息
     */
    //ListParts listParts(String bucketName,String objectName,Integer maxParts,String uploadId);
}
